package sample.chapter6.patterMatching;

import java.io.Console;
import java.util.Scanner;
import java.util.regex.Pattern;

public class ScanIn 
{
	public static void main(String[] args)
	{
		Console c = System.console();
		Scanner s = new Scanner(c.readLine("%s", "Input: "));
		String regex = c.readLine("%s", "Regex: ");
		String token;
		do
		{
			token = s.findInLine(Pattern.compile(regex));
			System.out.println("Found: "+token);
		}
		while(token!=null);
	}
}
